import 'package:flutter/material.dart';

class CheckBoxDemo extends StatefulWidget {
  const CheckBoxDemo({super.key});

  @override
  State<CheckBoxDemo> createState() => _CheckBoxDemoState();
}

class _CheckBoxDemoState extends State<CheckBoxDemo> {
  bool _checkBoxItemA = true;
  bool _checkBoxItemB = false;

  @override
  Widget build(BuildContext context) {
    
    return Scaffold(
      appBar: AppBar(
        title: Text('CheckBoxDemo'),
        elevation: 0.0,
      ),
      body: Container(
          padding: EdgeInsets.all(16.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              CheckboxListTile(value: _checkBoxItemA, onChanged: (value){
                  setState(() {
                    _checkBoxItemA = value!;
                  });
              },
              title: Text('Checkbox item A'),
              subtitle: Text('Description'),
              secondary: Icon(Icons.bookmark),
              selected: _checkBoxItemA,
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Checkbox(value: _checkBoxItemB, onChanged: (value){
                    setState(() {
                      _checkBoxItemB = value!;
                    });
                  },
                  activeColor: Colors.black,)
                ],
              ),
            ],
          )),
    );
  }
}
